﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace CreateConnectedTask
{
   internal class TFSAccess
    {
       private readonly TfsTeamProjectCollection _TeamProjectCollection = null;
       private readonly WorkItemStore _WorkItemStore = null;
       private  FieldDefinitionCollection fields;
       private string _Server = string.Empty;
       private string _Project = string.Empty;
       public TFSAccess(string serverName, string projectName, TfsTeamProjectCollection collection)
        {
            if (string.IsNullOrEmpty(serverName))
            {
                throw new ArgumentNullException("serverName", "servername is null");
            }
            if (string.IsNullOrEmpty(projectName))
            {
                throw new ArgumentNullException("projectName", "projectName is null");
            }
            _Server = serverName;
            _Project = projectName;
            _TeamProjectCollection = collection;

            // Get the Test Management Service
            WorkItemStore service =(WorkItemStore) collection.GetService(typeof(WorkItemStore));
            _WorkItemStore = service;

        }
       internal TfsTeamProjectCollection TeamProjectCollection
       {
           get
           {
               return _TeamProjectCollection;
           }
         
       }

       internal WorkItemStore WorkItemStore
       {
           get
           {
               return _WorkItemStore ;
           }
          
       }
       internal string SelectedProject()
       {
           return _Project;
       }
    }
}
